\clearpage
\chapter{Video Analysis and Statistics}\label{appendix:video}
\fxnote{Document how we obtain video info by commandlines etc.}
\fxnote{note that the sign ' is not ' ... commandline thing...}
\fxnote{-vcodec copy ignores -g specifiation..}
\fxnote{When changing GOP, mathing bitrate of original video gives approx. same filesize.. So: When transcoding for new GOP, match bitrate to orig.}

Extract and save I-frames from a video using ffmpeg.
{\footnotesize
\begin{verbatim}
ffmpeg -i INPUTFILE -vf select="eq(pict_type\,I)" -vsync 0 %05d.jpg
\end{verbatim}
}

Transcode a given inputfile with a qscale to codec with gop\_size to outputfile.	

{\footnotesize
\begin{verbatim}
ffmpeg -i INPUTFILE -qscale QSCALE -vcodec CODEC -g GOP_SIZE -an OUTPUTFILE
\end{verbatim}
}

Save a log with frame type and position (byte index) for all frames in a video file. 

{\footnotesize
\begin{verbatim}
ffprobe -show_frames INPUTFILE |grep 'pict_type\|pkt_pos\|[FRAME]\|[/FRAME]' > log.txt
\end{verbatim}
}




%% Junk
%ffmpeg -i video.mp4 -vf select="eq(pict_type\,I)" -vsync 0 -f image2 ~/Desktop/video%03d.jpg
%ffmpeg transcode command:
%ffmpeg -i "path+inputfilename" -b "bitrate in bits/s (200k is 200 kbits/s)" -r "frames/s" -vcodec "video codec used" -g "Group-of-pictures size" -an "(no audio)" "outputfile"
%GOP size = 0 gives only key frames!
%ffmpeg -i big_buck_bunny_480p_surround_No_Audio.avi -qscale 10 -vcodec mpeg4 -an -g 10 big_buck_bunny_480p_surround_No_Audio_GOP10_qscale1.avi 
%Frames and their size:
%ffprobe -show_frames -pretty big_buck_bunny_480p_surround_No_Audio.avi|grep 'pict_type\|pkt_pos\|[FRAME]\|[/FRAME]' > test12.txt
